package com.qyine.rlmall.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置上传文件映射
 *
 * @author Mo Fucheng
 * @version 0.0.1
 * @mail mofucheng@ru-liang.cn
 * @date 2021/12/6 14:13
 */
@Configuration
public class FileWebMvcConfigurer implements WebMvcConfigurer {

    @Value("${rlmall.upload.config.path}")
    private String rlmallUploadConfigPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/oss/**").addResourceLocations("file:" + rlmallUploadConfigPath);
    }

}
